<?php

//  		$this -> chromephp -> log('这是查询语句:'.$sql);

class User extends CI_Model{
	function __construct(){
		parent::__construct();
		
		//测试后删除
		$this->load->library('ChromePhp');
	}
	
	public function Login($user_account, $user_password){
		$sql = 'select * from user where user_account = "' . $user_account .'" and user_password = "' . md5($user_password) . '"';
		$query = $this->db->query($sql);
		$query = count($query) > 0 ? $query : false;
		return $query;		
	}
	
	public function getUserInfo(){
		$sql = 'select * from user_info where uid='.$this->session->userdata('user_id');
		$query = $this->db->query($sql);
		$query = count($query) > 0 ? $query : false;
		return $query;
	}
	
	public function setUserInfo($user_name, $user_new_password, $user_email, $user_email_password, $synchro){
		$sql = 'update user_info set user_name="' . $user_name . '" , user_email="' . $user_email . '" , user_email_password="'. $user_email_password . '", synchro=' . $synchro . '  where uid='. $this->session->userdata('user_id');
		
		$this -> chromephp -> log($sql);
		
		

	}
}
